package com.lglbc;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author 乐哥聊编程
 * @Doc 关注公众号"乐哥聊编程"获取文档和源码
 * @Date 2023/6/18
 * @Description
 */
@RestController
public class Index {
    @RequestMapping("/serviceInfo")
    public String serviceInfo(@RequestHeader(name = "name", required = false) String name,  HttpServletRequest request){
        return "我是service2:"+name;
    }
    @RequestMapping("/serviceInfoMap")
    public Map<String, String> serviceInfoMap(HttpServletRequest request){
        Map<String, String> map = new HashMap<>();
        map.put("serviceName","我是service2");
        map.put("name","ams");
        return map;
    }
}
